CREATE EXTERNAL TABLE IF NOT EXISTS spmi_dwd.dwd_volume_cost_profit_bill_dt(
waybill_no                                         String                         COMMENT '运单编号',
package_no                                         String                         COMMENT '包号',
sign_time                                          timestamp                      COMMENT '签收时间',
waybill_time                                       timestamp                      COMMENT '运单时间',
send_time                                          timestamp                      COMMENT '发件时间',
create_time                                        timestamp                      COMMENT '账单产生时间',
arrival_time                                       timestamp                      COMMENT '到件时间',
bill_generation_time                               timestamp                      COMMENT '业务发生时间',
entry_mark_time                                    timestamp                      COMMENT '入账时间',
bill_update_time                                   timestamp                      COMMENT '账单修改时间',
entry_mark                                         smallint                       COMMENT '入账标识 1 是 2 否',
begin_province_id                                  bigint                         COMMENT '始发省份ID',
begin_province_name                                String                         COMMENT '始发省份名称',
begin_id                                           bigint                         COMMENT '始发地ID',
begin_name                                         String                         COMMENT '始发地名称',
destination_id                                     bigint                         COMMENT '目的地ID',
destination_name                                   String                         COMMENT '目的地名称',
destination_province_id                            bigint                         COMMENT '目的省份ID',
destination_province_name                          String                         COMMENT '目的省份名称',
customer_code                                      String                         COMMENT '客户编码',
customer_name                                      String                         COMMENT '客户名称',
package_receipt_weight                             decimal(12,2)                  COMMENT '入仓重量',
arrival_weight                                     decimal(12,2)                  COMMENT '中心到件重量',
cost_weight                                        decimal(12,2)                  COMMENT '计费重量',
package_charge_weight_source                       String                         COMMENT '计费重量来源',
settle_weight                                      decimal(12,2)                  COMMENT '结算重量',
waybill_piece                                      bigint                         COMMENT '运单件数',
waybill_num                                        bigint                         COMMENT '运单票数',
send_network_name                                  String                         COMMENT '寄件网点名称',
send_network_code                                  String                         COMMENT '寄件网点编码',
send_franchisee_name                               String                         COMMENT '寄件加盟商NAME',
send_franchisee_code                               String                         COMMENT '寄件加盟商CODE',
send_financial_center_name                         String                         COMMENT '寄件代理区名称',
send_financial_center_code                         String                         COMMENT '寄件代理区编码',
operation_network_name                             String                         COMMENT '操作网点名称',
operation_network_code                             String                         COMMENT '操作网点编码',
operation_financial_center_name                    String                         COMMENT '操作代理区名称',
operation_financial_center_code                    String                         COMMENT '操作代理区编码',
start_financial_center_name                        String                         COMMENT '始发代理区名称',
start_financial_center_code                        String                         COMMENT '始发代理区编码',
piece_network_name                                 String                         COMMENT '派件网点名称',
piece_network_code                                 String                         COMMENT '派件网点编码',
piece_franchisee_name                              String                         COMMENT '派件加盟商NAME',
piece_franchisee_code                              String                         COMMENT '派件加盟商CODE',
piece_financial_center_name                        String                         COMMENT '派件代理区名称',
piece_financial_center_code                        String                         COMMENT '派件代理区编码',
fee_type_code                                      String                         COMMENT '费用类型编码',
fee_type_id                                        int                            COMMENT '费用类型ID',
fee_type_name                                      String                         COMMENT '费用类型名称',
fee_cost                                           decimal(12,6)                  COMMENT '费用金额',
is_bubble                                          smallint                       COMMENT '计泡标识 1 是 2 否',
is_sign                                            smallint                       COMMENT '签收标识 1是2否',
retrieve_status                                    smallint                       COMMENT '回收标识 1是 2否',
is_refund                                          smallint                       COMMENT '退件标识1是2否',
transport_type_name                                String                         COMMENT '运输方式名称',
transport_type_code                                String                         COMMENT '运输方式编码',
product_type_name                                  String                         COMMENT '产品类型名称',
product_type_code                                  String                         COMMENT '产品类型编码',
describe_name                                      smallint                       COMMENT '账单描述',
is_lock                                            smallint                       COMMENT '锁账标识1是2否',
remarks                                            String                         COMMENT '备注',
piece_destination_province_id                      bigint                         COMMENT '派件费目的省份ID',
piece_destination_province_name                    String                         COMMENT '派件费目的省份名称',
package_votes                                      bigint                         COMMENT '大包运单票数',
package_fees                                       decimal(12,6)                  COMMENT '大包费用金额'
)
COMMENT '量本利明细表'
PARTITIONED BY (
       table_type STRING COMMENT '表分类' ,
       dt STRING COMMENT '运单生成日期 (yyyy-MM-dd)' )
STORED AS PARQUET
LOCATION '/dw/hive/spmi_dwd.db/external/dwd_volume_cost_profit_bill_dt'
TBLPROPERTIES (
  'parquet.column.index.access'='true'
);